package com.xiaoyun.rollutil.controller;

import com.xiaoyun.rollutil.entity.WeatherInfo;
import com.xiaoyun.rollutil.service.IWeatherService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: XiaoYun461
 * @Date: 2021/12/2 20:29
 */
@RestController
@AllArgsConstructor
public class WeatherController {

    private final IWeatherService weatherService;

    @GetMapping("getWeather")
    public WeatherInfo getWeather(String code) {
        return weatherService.getCurrentWeatherByCode(code);
    }
}
